package 字节码文件.同步控制指令;

/**
 * <P> @Author: ideaAdmin
 * <P> TODO: Class
 * <P> TODO: 同步控制指令
 * <P> Date: 2022/3/27:21:52
 * <P> Description:
 */

public class SynchronizedTest {

    public synchronized void add(){
        i++;
    }

    private int i= 0;
    private Object obj = new Object();
    public void subtract(){
        synchronized (obj){
            i--;
        }
    }
}
